package recursion;

/**
 * 简单递归练习
 */
public class RecursionTest {
    public static void main(String[] args) {
        System.out.println(sum(10) + "\t" + mul(5));
    }

    public static int sum(int n) {
        if (n == 1) {
            return 1;
        }
        return sum(n - 1) + n;
    }

    public static int mul(int n) {
        if (n == 1) {
            return 1;
        }
        return mul(n - 1) * n;
    }
}
